package com.example.assignment4;

import lombok.Data;

import java.util.Objects;

@Data
public class commodity {

    Long id;

    String name;

    float price;

    public commodity() {
    }

    public commodity(Long id, String name, float price) {
        this.id = id;
        this.name = name;
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        commodity commodity = (com.example.assignment4.commodity) o;
        return Float.compare(commodity.price, price) == 0 && Objects.equals(id, commodity.id) && Objects.equals(name, commodity.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, price);
    }
}
